package com.emergency.db.dao.item;

import com.emergency.db.domain.item.ItemDose;
import com.emergency.db.domain.staff.StaffDose;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface ItemDoseDao extends JpaRepository<ItemDose, Long>, JpaSpecificationExecutor<ItemDose> {
    @Modifying
    @Query(value = "delete FROM bas_item_dose WHERE item_id = ? ", nativeQuery = true)
    void deleteAllByItem(Long id);

    @Query(value = "select * from bas_item_dose where item_id= ? ", nativeQuery = true)
    Page<ItemDose> findAllByItem(@Param("id") Long id, Pageable p);
}
